package cn.ming.wfchat.app.moment.third.adapters;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import cn.ming.wfchat.R;
import cn.ming.wfchat.app.moment.third.beans.FriendCircleBean;
import cn.ming.wfchat.app.moment.third.interfaces.OnCommentLike;
import cn.ming.wfchat.app.moment.third.interfaces.OnCommentReply;
import cn.ming.wfchat.app.moment.third.interfaces.OnCommentUserClickListener;
import cn.ming.wfchat.app.moment.third.interfaces.OnFeedItemLongClickListener;
import cn.ming.wfchat.app.moment.third.interfaces.OnFeedUserClickListener;
import cn.ming.wfchat.app.moment.third.interfaces.OnTogglePraiseOrCommentPopupWindowListener;
import cn.ming.wfchat.app.moment.third.interfaces.OnTopTheMenu;
import cn.ming.wfchat.app.utils.ImageLoaderUtil;
import cn.ming.wfchat.kit.WfcWebViewActivity;
import cn.ming.wfchat.kit.mm.MMPreviewActivity;


class WordAndUrlViewHolder extends BaseFriendCircleViewHolder {

    LinearLayout layoutUrl;
    TextView texturl;
    ImageView imageView;

    public WordAndUrlViewHolder(View itemView) {
        super(itemView);
        layoutUrl = itemView.findViewById(R.id.layout_url);
        texturl = itemView.findViewById(R.id.txt_urltext);
        imageView = itemView.findViewById(R.id.iv_guanggao);

    }

    @Override
    public void makeUserBaseData(BaseFriendCircleViewHolder holder, Context context, FriendCircleBean friendCircleBean, int position, boolean onlyPraise, boolean onlyComment, OnFeedItemLongClickListener onFeedItemLongClickListener, OnFeedUserClickListener onFeedUserClickListener, OnCommentUserClickListener onCommentUserClickListener, OnTogglePraiseOrCommentPopupWindowListener onTogglePraiseOrCommentPopupWindowListener, OnCommentLike onCommentLike, OnCommentReply onCommentReply, OnTopTheMenu onTopTheMenu) {
        super.makeUserBaseData(holder, context, friendCircleBean, position, onlyPraise, onlyComment, onFeedItemLongClickListener, onFeedUserClickListener, onCommentUserClickListener, onTogglePraiseOrCommentPopupWindowListener, onCommentLike, onCommentReply, onTopTheMenu);
       // texturl.setText(friendCircleBean.getContent());
        if (friendCircleBean.getMediaEntries() != null) {
            ImageLoaderUtil.display(imageView, friendCircleBean.getMediaEntries().get(0).getMediaUrl());
        }
        holder.txtUserName.setText(friendCircleBean.getDisplayName());
        ImageLoaderUtil.display(holder.imgAvatar, friendCircleBean.getPortrait());
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                MMPreviewActivity.startActivity(context, friendCircleBean.getMediaEntries(), 0);
            }
        });
        layoutUrl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                WfcWebViewActivity.loadUrl(context, friendCircleBean.getContent(), friendCircleBean.getLink());
            }
        });
    }
}
